import * as bm from "/js/baseModule.js";

export class Module extends bm.baseModule {
    constructor(view) {
        super(view);
        this._sign = "";
        this._saveTarget = this.find('.active');
        let vueDom = this.find("#news_vue").get(0);
        let user = globalData.user;
        new Vue({
            el: vueDom,
            data: {
                isActive: false,
            }
        });
    }
    _evt_openBlock(target, hit) {
        var that = this;
        var sign = $(target).attr("sign");
        if (that._sign == sign) {
            return;
        }
        if (sign == "Index") {
            that._saveTarget = target;
            that._saveHit = hit;
        } else if (sign == "Message") {
            funs.openModal('modules/modals/BlackAccount.js',function (mod) {
                // mod.setType(12,{level:"铜牌"});
            })
        }
        else if (sign == "UserNav") {
            //如果是游客/客户点击了需要登录的选项
            if (globalData.user.user_type != 100) {
                if(globalData.user.user_type == 1){
                    funs.openModal('modules/modals/CommonModal.JS',function (mod) {
                        mod.setType(2);
                    })
                }else{
                    funs.openModal('modules/modals/CommonModal.JS',function (mod) {
                        mod.setType(1);
                    })
                }
                return
            }else{
                funs.swipeModule('modules/user/UserNav.js','66%','left',null)
            }
        }
        /**移除所有active */
        that.classReset();
        $(target).addClass('active');
        $(target).children("span:first").attr('class', $(target).children("span:first").attr('class') + '1');

    }

    backIndex(){
        this._evt_openBlock(this.find('.faxian')[0], this._saveHit);
    }
    /**移除所有active */
    classReset() {
        this.find('.foot-block').removeClass('active');
        this.find('.faxian').children("span:first").attr('class', 'icon-faxian');
        this.find('.news').children("span:first").attr('class', 'icon-news');
        this.find('.me').children("span:first").attr('class', 'icon-me');
    }
}